<?php
// Check if there is some posts
if (isset($posts) && !empty($posts)) :
?>
<?php
foreach ($posts as $post) {
?>
<div class="post">
    <h2 class="title">
        <a href="?r=ml-blog/post&id=<?php echo $post->id; ?>">
            <?php echo $post->title; ?>
        </a>
    </h2>
    <div class="meta">
        <span class="date"><?php echo $post->created_at->format('Y-m-d H:i:s'); ?></span>
        <span class="posted">Posted by <a href="#"><?php echo $post->profile->user->login; ?></a></span>
    </div>
    <div style="clear: both;">&nbsp;</div>
    <p class="entry">
        <?php echo MString::truncate($post->html_content, 1000, '...', true); ?>
    </p>
    <p class="links">
        <a href="?r=ml-blog/post&id=<?php echo $post->id; ?>">Read More</a>&nbsp;&nbsp;&nbsp;&nbsp;|&nbsp;&nbsp;&nbsp;&nbsp;<a href="<?php echo __route('ml-blog/post', array('id'=>$post->id))."#comments"; ?>"><?php echo __t('mandrill.blog.comment', NULL, 'ml-blog', 'modules').' ('.count($post->comments).')'; ?></a>
    </p>
</div>
<div style="clear: both;">&nbsp;</div>
<?php
}
?>
<?php
// No posts
else :
?>
<div class="ml-info">
<?php echo MTranslator::translate('mandrill.blog.posts.empty', array(), 'ml-blog', 'modules') ?>
</div>
<?php
endif;
?>